import {
  departmentTree,
  departmentSelect,
  menuTree,
  menuDrag,
  menuaddTree,
  subsysSelect,
  menuDelete,
  menuTreeSelect,
  snbsysSelect,
  snbsysInsert,
  snbsysDelete,
  snbsysUpdate,
  menuUpdate,
  orgTree,
  orgTreeInsert,
  orgTreeSelect,
  orgTreeUpdate,
  orgTreeDelete,
  sysGroupselect,
  sysGroupInsert,
  sysGroupUpdate,
  sysGroupDelete,
  selectExistUser,
  selectNoExistUser,
  sysOrgAdmin,
  sysOrgAdminDELETE,
  selectExistGroupUser,
  selectNoExistGroupUser,
  groupUserbatch,
  groupUserForceBatch,
  getCodeList
} from '@/api/service'
const system = {
  actions: {
    // 系统企业获取树形结构
    DepartmentTree({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        departmentTree(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 系统企业检索
    DepartmentSelect({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        departmentSelect(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 菜单信息获取
    MenuTree({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        menuTree(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 菜单拖拽
    MenuDrag({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        menuDrag(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 菜单插入
    MenuaddTree({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        menuaddTree(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 子系统检索
    SubsysSelect({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        subsysSelect(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 菜单删除
    MenuDelete({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        menuDelete(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 菜单更新
    MenuUpdate({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        menuUpdate(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 菜单信息检索
    MenuTreeSelect({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        menuTreeSelect(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 子系统检索
    SnbsysSelect({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        snbsysSelect(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 子系统插入
    SnbsysInsert({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        snbsysInsert(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 子系统删除
    SnbsysDelete({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        snbsysDelete(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 子系统更新
    SnbsysUpdate({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        snbsysUpdate(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 系统组织机构树
    OrgTree({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        orgTree(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 系统组织机构树插入
    OrgTreeInsert({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        orgTreeInsert(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 系统组织机构树检索
    OrgTreeSelect({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        orgTreeSelect(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 系统组织机构树更新
    OrgTreeUpdate({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        orgTreeUpdate(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 系统组织机构树删除
    OrgTreeDelete({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        orgTreeDelete(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 系统岗位信息检索
    SysGroupselect({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        sysGroupselect(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 系统岗位信息插入
    SysGroupInsert({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        sysGroupInsert(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 系统岗位信息更新
    SysGroupUpdate({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        sysGroupUpdate(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 系统岗位信息删除
    SysGroupDelete({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        sysGroupDelete(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 查询已经设置的人员
    SelectExistUser({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        selectExistUser(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 查询未设置的人员
    SelectNoExistUser({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        selectNoExistUser(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 组织机构管理员插入
    SysOrgAdmin({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        sysOrgAdmin(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 组织机构管理员删除
    sysOrgAdminDELETE({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        sysOrgAdminDELETE(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 查询已经设置的岗位人员
    SelectExistGroupUser({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        selectExistGroupUser(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 查询未设置的岗位人员
    SelectNoExistGroupUser({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        selectNoExistGroupUser(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 岗位人员插入
    GroupUserbatch({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        groupUserbatch(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 岗位人员删除
    GroupUserForceBatch({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        groupUserForceBatch(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 码表
    GetCodeList({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        getCodeList(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default system
